import { onMounted, onUnmounted } from 'vue'

export function useEventListener(event:string, callback:EventListenerOrEventListenerObject){
  // 初始化事件监听
  onMounted(() => {
    window.addEventListener(event, callback)
  })

  // 移除事件监听
  onUnmounted(() => {
    window.removeEventListener(event, callback)
  })
}